﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DFT.DB;
using DFT.Infos;

namespace DFT
{
    public partial class MasterPage : System.Web.UI.MasterPage
    {
        public String fullName, email, lastLogin, registrationDt;

        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["userInfo"] != null)
            {
                UserInfo userInfo = new UserInfo();
                userInfo = (UserInfo)Session["userInfo"];
                fullName = userInfo.FullName;
                email = userInfo.Email;
                lastLogin = userInfo.Lastlogin.ToString();
                registrationDt = userInfo.RegistrationDt.ToShortDateString();
            }
            else
            {
                Response.Redirect("Default.aspx?returnUrl=" + Request.RawUrl);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void logout_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            if (Request.Cookies["userEmail"] != null && Request.Cookies["userPass"] != null)
            {
                Response.Cookies["userEmail"].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies["userPass"].Expires = DateTime.Now.AddDays(-1);
            }
            Response.Redirect("Default.aspx");
        }

    }
}